<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    //求1-100的累加值，碰到个位数3的停止累加
    var sum = 0;
    for (var i = 0; i <= 100; i++) {
        if (i % 10 == 3) {
            continue;
        }
        sum += i;
    }
    console.log(sum);
    //冒泡数列
    var array2 = [9, 65, 3, 465, 32, 0];
    for (var i = 0; i <= array2.length - 1; i++) {
        for (var j = 0; j <= array2.length - 1 - i; j++) {
            if (array2[j] > array2[j + 1]) {
                var temp = array2[j];
                array2[j] = array2[j + 1];
                array2[j + 1] = temp;
            }
        }
    }
    console.log(array2);
    //1-100不能被7整除的和
    var sum1 = 0;
    for (var i = 0; i <= 100; i++) {
        if (i % 7 == 0) {
            continue;
        }
        sum1 += i;
    }
    console.log(sum1);
    //200-300奇数的和
    var sum2 = 0;
    for (var i = 200; i <= 300; i++) {
        if (i % 2 == 0) {
            continue;
        }
        sum2 += i;
    }
    console.log(sum2);
    //求2个数中的最大值
    var arr = [10, 20];
    var max = arr[0];
    for (var i = 1; i <= arr.length; i++) {
        if (max < arr[i]) {
            max = arr[i];
        }
    }
    console.log(max);
    //求三个数中的最大值
    var arr1 = [10, 20, 30];
    var max1 = arr1[0];
    for (var i = 1; i <= arr1.length; i++) {
        if (max1 < arr1[i]) {
            max1 = arr1[i]
        }
    }
    console.log(max1);

    //判断一个数是否为素数
    function prime(x) {
        if (x / x == 1) {
            return "这个数字为素数"
        }
    }

    // var prime=parseInt(prompt("请输入一位数字"));


</script>
</body>
</html>